home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
man
/
oldman3
/
Pair.3T
< prev
next >
Wrap
Text File
|
1992-06-29
|
3KB
|
101 lines
.TH PAIR
.SH NAME
Pair<T1,T2> A parameterized pair
.SH SYNOPSIS
#include <cool/Pair.h>
.SH DESCRIPTION
The parameterized \f3Pair<T1,T2>\f1 class implements an association between one
object and another. The objects may be of different types, with the first
representing the
key
of the pair and the second representing the
value
of the
pair. The \f3Pair<T1,T2>\f1 class is used by the \f3Association<Ktype,Vtype>\f1 class to
implement an association list (that is, a vector of pairs of associated
values).
.SH Base Classes
None
.SH Friend Classes
None
.SH Constructors
.TP
\f3Pair<T1,T2> \f3();\f1
Creates an empty pair of the specified types.
.TP
\f3Pair<T1,T2> \f3(const Pair<T1,T2>>>&\f3);\f1
Duplicates the size and value of a pair object.
.TP
\f3Pair<T1,T2> (const \f2T1&\f3, const \f2T2&\f3);\f1
Creates a pair from the two specified elements.
.SH Member Functions
.TP
\f3inline const \f2T1& \f3get_first () const;\f1
Returns a constant reference to the first element of the pair.
.TP
\f3inline const \f2T2& \f3get_second () const;\f1
Returns a constant reference to the second element of the pair.
.TP
\f3inline T1& first ();\f1
Returns a reference to the first element of the pair.
.TP
\f3Pair<T1,T2>& \f3operator= (Pair<T1,T2>>>&\f3);\f1
Assigns one pair object to have the value of another by duplicating element
values.
.TP
\f3Boolean operator== (Pair<T1,T2>&)\f3 const;\f1
Returns
TRUE
if the pairs have the same element values; otherwise, this
function returns
FALSE .
.TP
\f3inline Boolean operator!= (Pair<T1,T2>>>&\f3) const;\f1
Returns
TRUE
if the pairs have different element values; otherwise, this
function returns
FALSE .
.TP
\f3inline T2& second ();\f1
Returns a reference to the second element of the pair.
.TP
\f3void set_compare (\f2Pair_Compare \f3= NULL);\f1
Updates the compare function for this class of pair.
Pair_Compare
is a function
of type
Boolean
(\f2*Function\f1)(\f3const Pair<T1,T2>&\f1, \f3const Pair<T1,T2>&\f1). If no
argument is provided, the
operator==
for the types over which the class is
parameterized are used.
.TP
\f3inline void set_first (const \f2T1&\f3);\f1
Sets the first element of the pair to the specified value.
.TP
\f3inline void set_second (const \f2T2&\f3);\f1
Sets the second element of the pair to the specified value.
.SH Friend Functions
.TP
\f3friend ostream& operator<< (ostream& \f2os\f3, const Pair<T1,T2>>>&\f3);\f1
Provides a formatted output capability for reference to a \f3Pair<T1,T2>\f1 object.
.TP
\f3inline friend ostream& operator<< (ostream& \f2os\f3, const Pair<\f2T1,T2>*);\f1
Provides a formatted output capability for a pointer to a \f3Pair<T1,T2>\f1 object.
.SH COPYRIGHT
Copyright (C) 1991 Texas Instruments Incorporated.
Permission is granted to any individual or institution to use, copy, modify,
and distribute this software, provided that this complete copyright and
permission notice is maintained, intact, in all copies and supporting
documentation.
Texas Instruments Incorporated provides this software "as is" without
express or implied warranty.